<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var divingBoard = function (a, b, k) {
      if (k === 0) return []
      // 如果长短都一样，那就只有一种结果．k块长的，或k块短的．
      if (a === b) {
        return [k * b]
      }
      var res = []
      for (var i = 0; i <= k; i++) {
        // 如果有i块长的，短的必然是k - i块．
        res.push(i * b + (k - i) * a)
      }
      return res
    };
    console.log(divingBoard(a = 1, b = 2, k = 3));
  </script>
</body>

</html>